<template>
    <nav class="navbar navbar-default navbar-fixed-top noprint">
            <div class="container-fluid">
                <div class="navbar-header">
                    <a class="navbar-brand" href="javascript:">
                        <!-- <img alt="Brand" src="../assets/logo.png" width="24" height="24"> -->
                    </a>
                    <a class="navbar-brand"href="javascript:">后台</a>

                </div>
                <ul class="nav navbar-nav">
                    <li :class="{'active':$route.name=='orderpage'}">
                        <a href="###" @click.prevent="goToPage('orderpage')">
                            <i class="fa fa-tasks"></i>
                            <span class="nav-label">订单</span>
                        </a>
                    </li>
                    <li :class="{'active':$route.name=='goodspage'}">
                        <a href="###" @click.prevent="goToPage('goodspage')">
                            <i class="fa fa-commenting"></i>
                            <span class="nav-label">产品</span>
                        </a>
                    </li>
                    
                    <li :class="{'active':$route.name=='promotionpage'}">
                        <a href="###" @click.prevent="goToPage('promotionpage')">
                            <i class="fa fa-check-square-o"></i>
                            <span class="nav-label">活动</span>
                        </a>
                    </li>
                    <li :class="{'active':$route.name=='userpage'}" v-if="$root.USER_TYPE==0">
                        <a href="###" @click.prevent="goToPage('userpage')">
                            <i class="fa fa-share-square-o"></i>
                            <span class="nav-label">用户</span>
                        </a>
                    </li>
                    <li :class="{'active':$route.name=='paypage'}">
                        <a href="###" @click.prevent="goToPage('paypage')">
                            <i class="fa fa-share-square-o"></i>
                            <span class="nav-label">收银</span>
                        </a>
                    </li>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <p class="navbar-text">
                            <i class="fa fa-user"></i>
                            &nbsp;{{$root.USER_NAME}}
                        </p>
                    </li>
                    <li><p class="navbar-text"><i class="fa fa-power-off"></i>&nbsp;
                    <a href="javascript:" class="navbar-link" @click.prevent="logout">退出</a></p></li>
                </ul>

            </div>
        </nav>
</template>
<script>
    import Topbarnotice from './Topbarnotice.vue';
    import {
        tip,
        ajax
    } from '../tools/tools.js'

    export default {
        name: 'Navheader',
        components:{Topbarnotice},
        data(){
            return {
                number:'',
                in_search:false
            }
        },
        methods:{
            logout(){
                this.$root.$router.replace({
                    name:'logout'
                });
            },
            goToPage(r){
                this.$root.$router.push({
                    name:r
                });
                
            }
        }
    }
</script>
<style scoped>
.nav.navbar-nav li.active>a{
    background-color: #f90;
    color: #fff;
}
</style>